<?php
declare (strict_types = 1);

namespace leruge\command;;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\console\input\Argument;
use think\facade\Console;


class MakeMe extends Command
{
    protected $type = "Model";

    protected function configure()
    {
        parent::configure();
        $this->setName('me')
            ->addArgument('name', Argument::REQUIRED, '类名（例如：Admin）')
            ->setDescription('创建一个模型类和服务层');
    }



    protected function execute(Input $input, Output $output)
    {
        $name = trim($input->getArgument('name'));

        // 调用已有命令 "model"
        Console::call('model', [$name]);
        // 调用已有命令 "entity"
        Console::call('entity', [$name]);

        $output->writeln("<info>✅ 成功生成 Model 和 Entity：</info> {$name}");
    }
}
